android.ndk.input

@file input.h

Members

Enums

AINPUT_EVENT_TYPE_KEY
enum AINPUT_EVENT_TYPE_KEY

Input event types.

AINPUT_KEYBOARD_TYPE_NONE
enum AINPUT_KEYBOARD_TYPE_NONE

Keyboard types.

AINPUT_MOTION_RANGE_X
enum AINPUT_MOTION_RANGE_X

Constants used to retrieve information about the range of motion for a particular coordinate of a motion event.

AINPUT_SOURCE_CLASS_MASK
enum AINPUT_SOURCE_CLASS_MASK

Input source masks.

AINPUT_SOURCE_UNKNOWN
enum AINPUT_SOURCE_UNKNOWN

Input sources.

AKEY_EVENT_ACTION_DOWN
enum AKEY_EVENT_ACTION_DOWN

Key event actions.

AKEY_EVENT_FLAG_WOKE_HERE
enum AKEY_EVENT_FLAG_WOKE_HERE

Key event flags.

AKEY_STATE_UNKNOWN
enum AKEY_STATE_UNKNOWN

Key states (may be returned by queries about the current state of a particular key code, scan code or switch).

AMETA_NONE
enum AMETA_NONE

Meta key / modifier state.

AMOTION_EVENT_ACTION_MASK
enum AMOTION_EVENT_ACTION_MASK

Motion event actions

AMOTION_EVENT_AXIS_X
enum AMOTION_EVENT_AXIS_X

Constants that identify each individual axis of a motion event. @anchor AMOTION_EVENT_AXIS

AMOTION_EVENT_BUTTON_PRIMARY
enum AMOTION_EVENT_BUTTON_PRIMARY

Constants that identify buttons that are associated with motion events. Refer to the documentation on the MotionEvent class for descriptions of each button.

AMOTION_EVENT_EDGE_FLAG_NONE
enum AMOTION_EVENT_EDGE_FLAG_NONE

Motion event edge touch flags.

AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED
enum AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED

Motion event flags.

AMOTION_EVENT_TOOL_TYPE_UNKNOWN
enum AMOTION_EVENT_TOOL_TYPE_UNKNOWN

Constants that identify tool types. Refer to the documentation on the MotionEvent class for descriptions of each tool type.

Functions

AInputEvent_getDeviceId
int AInputEvent_getDeviceId(const(AInputEvent)* event)

Get the id for the device that an input event came from.

AInputEvent_getSource
int AInputEvent_getSource(const(AInputEvent)* event)

Get the input event source.

AInputEvent_getType
int AInputEvent_getType(const(AInputEvent)* event)

Get the input event type.

AInputQueue_attachLooper
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data)

Add this input queue to a looper for processing. See ALooper_addFd() for information on the ident, callback, and data params.

AInputQueue_detachLooper
void AInputQueue_detachLooper(AInputQueue* queue)

Remove the input queue from the looper it is currently attached to.

AInputQueue_finishEvent
void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled)

Report that dispatching has finished with the given event. This must be called after receiving an event with AInputQueue_get_event().

AInputQueue_getEvent
int AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent)

Returns the next available event from the queue. Returns a negative value if no events are available or an error has occurred.

AInputQueue_hasEvents
int AInputQueue_hasEvents(AInputQueue* queue)

Returns true if there are one or more events available in the input queue. Returns 1 if the queue has events; 0 if it does not have events; and a negative value if there is an error.

AInputQueue_preDispatchEvent
int AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event)

Sends the key for standard pre-dispatching -- that is, possibly deliver it to the current IME to be consumed before the app. Returns 0 if it was not pre-dispatched, meaning you can process it right now. If non-zero is returned, you must abandon the current event processing and allow the event to appear again in the event queue (if it does not get consumed during pre-dispatching).

AKeyEvent_getAction
int AKeyEvent_getAction(const(AInputEvent)* key_event)

Get the key event action.

AKeyEvent_getDownTime
long AKeyEvent_getDownTime(const(AInputEvent)* key_event)

Get the time of the most recent key down event, in the java.lang.System.nanoTime() time base. If this is a down event, this will be the same as eventTime. Note that when chording keys, this value is the down time of the most recently pressed key, which may not be the same physical key of this event.

AKeyEvent_getEventTime
long AKeyEvent_getEventTime(const(AInputEvent)* key_event)

Get the time this event occurred, in the java.lang.System.nanoTime() time base.

AKeyEvent_getFlags
int AKeyEvent_getFlags(const(AInputEvent)* key_event)

Get the key event flags.

AKeyEvent_getKeyCode
int AKeyEvent_getKeyCode(const(AInputEvent)* key_event)

Get the key code of the key event. This is the physical key that was pressed, not the Unicode character.

AKeyEvent_getMetaState
int AKeyEvent_getMetaState(const(AInputEvent)* key_event)

Get the meta key state.

AKeyEvent_getRepeatCount
int AKeyEvent_getRepeatCount(const(AInputEvent)* key_event)

Get the repeat count of the event. For both key up an key down events, this is the number of times the key has repeated with the first down starting at 0 and counting up from there. For multiple key events, this is the number of down/up pairs that have occurred.

AKeyEvent_getScanCode
int AKeyEvent_getScanCode(const(AInputEvent)* key_event)

Get the hardware key id of this key event. These values are not reliable and vary from device to device.

AMotionEvent_getAction
int AMotionEvent_getAction(const(AInputEvent)* motion_event)

Get the combined motion event action code and pointer index.

AMotionEvent_getAxisValue
float AMotionEvent_getAxisValue(const(AInputEvent)* motion_event, int axis, size_t pointer_index)

Get the value of the request axis for the given pointer index.

AMotionEvent_getButtonState
int AMotionEvent_getButtonState(const(AInputEvent)* motion_event)

Get the button state of all buttons that are pressed.

AMotionEvent_getDownTime
long AMotionEvent_getDownTime(const(AInputEvent)* motion_event)

Get the time when the user originally pressed down to start a stream of position events, in the java.lang.System.nanoTime() time base.

AMotionEvent_getEdgeFlags
int AMotionEvent_getEdgeFlags(const(AInputEvent)* motion_event)

Get a bitfield indicating which edges, if any, were touched by this motion event. For touch events, clients can use this to determine if the user's finger was touching the edge of the display.

AMotionEvent_getEventTime
long AMotionEvent_getEventTime(const(AInputEvent)* motion_event)

Get the time when this specific event was generated, in the java.lang.System.nanoTime() time base.

AMotionEvent_getFlags
int AMotionEvent_getFlags(const(AInputEvent)* motion_event)

Get the motion event flags.

AMotionEvent_getHistoricalAxisValue
float AMotionEvent_getHistoricalAxisValue(const(AInputEvent)* motion_event, int axis, size_t pointer_index, size_t history_index)

Get the historical value of the request axis for the given pointer index that occurred between this event and the previous motion event.

AMotionEvent_getHistoricalEventTime
long AMotionEvent_getHistoricalEventTime(const(AInputEvent)* motion_event, size_t history_index)

Get the time that a historical movement occurred between this event and the previous event, in the java.lang.System.nanoTime() time base.

AMotionEvent_getHistoricalOrientation
float AMotionEvent_getHistoricalOrientation(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index that occurred between this event and the previous motion event. An angle of 0 degrees indicates that the major axis of contact is oriented upwards, is perfectly circular or is of unknown orientation. A positive angle indicates that the major axis of contact is oriented to the right. A negative angle indicates that the major axis of contact is oriented to the left. The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians (finger pointing fully right).

AMotionEvent_getHistoricalPressure
float AMotionEvent_getHistoricalPressure(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical pressure of this event for the given pointer index that occurred between this event and the previous motion event. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), although values higher than 1 may be generated depending on the calibration of the input device.

AMotionEvent_getHistoricalRawX
float AMotionEvent_getHistoricalRawX(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical raw X coordinate of this event for the given pointer index that occurred between this event and the previous motion event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views. Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

AMotionEvent_getHistoricalRawY
float AMotionEvent_getHistoricalRawY(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical raw Y coordinate of this event for the given pointer index that occurred between this event and the previous motion event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views. Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

AMotionEvent_getHistoricalSize
float AMotionEvent_getHistoricalSize(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the current scaled value of the approximate size for the given pointer index that occurred between this event and the previous motion event. This represents some approximation of the area of the screen being pressed; the actual value in pixels corresponding to the touch is normalized with the device specific range of values and scaled to a value between 0 and 1. The value of size can be used to determine fat touch events.

AMotionEvent_getHistoricalToolMajor
float AMotionEvent_getHistoricalToolMajor(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index that occurred between this event and the previous motion event. The tool area represents the estimated size of the finger or pen that is touching the device independent of its actual touch area at the point of contact.

AMotionEvent_getHistoricalToolMinor
float AMotionEvent_getHistoricalToolMinor(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index that occurred between this event and the previous motion event. The tool area represents the estimated size of the finger or pen that is touching the device independent of its actual touch area at the point of contact.

AMotionEvent_getHistoricalTouchMajor
float AMotionEvent_getHistoricalTouchMajor(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical length of the major axis of an ellipse that describes the touch area at the point of contact for the given pointer index that occurred between this event and the previous motion event.

AMotionEvent_getHistoricalTouchMinor
float AMotionEvent_getHistoricalTouchMinor(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical length of the minor axis of an ellipse that describes the touch area at the point of contact for the given pointer index that occurred between this event and the previous motion event.

AMotionEvent_getHistoricalX
float AMotionEvent_getHistoricalX(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical X coordinate of this event for the given pointer index that occurred between this event and the previous motion event. Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

AMotionEvent_getHistoricalY
float AMotionEvent_getHistoricalY(const(AInputEvent)* motion_event, size_t pointer_index, size_t history_index)

Get the historical Y coordinate of this event for the given pointer index that occurred between this event and the previous motion event. Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

AMotionEvent_getHistorySize
size_t AMotionEvent_getHistorySize(const(AInputEvent)* motion_event)

Get the number of historical points in this event. These are movements that have occurred between this event and the previous event. This only applies to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. Historical samples are indexed from oldest to newest.

AMotionEvent_getMetaState
int AMotionEvent_getMetaState(const(AInputEvent)* motion_event)

Get the state of any meta / modifier keys that were in effect when the event was generated.

AMotionEvent_getOrientation
float AMotionEvent_getOrientation(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index. An angle of 0 degrees indicates that the major axis of contact is oriented upwards, is perfectly circular or is of unknown orientation. A positive angle indicates that the major axis of contact is oriented to the right. A negative angle indicates that the major axis of contact is oriented to the left. The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians (finger pointing fully right).

AMotionEvent_getPointerCount
size_t AMotionEvent_getPointerCount(const(AInputEvent)* motion_event)

Get the number of pointers of data contained in this event. Always >= 1.

AMotionEvent_getPointerId
int AMotionEvent_getPointerId(const(AInputEvent)* motion_event, size_t pointer_index)

Get the pointer identifier associated with a particular pointer data index in this event. The identifier tells you the actual pointer number associated with the data, accounting for individual pointers going up and down since the start of the current gesture.

AMotionEvent_getPressure
float AMotionEvent_getPressure(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current pressure of this event for the given pointer index. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), although values higher than 1 may be generated depending on the calibration of the input device.

AMotionEvent_getRawX
float AMotionEvent_getRawX(const(AInputEvent)* motion_event, size_t pointer_index)

Get the original raw X coordinate of this event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

AMotionEvent_getRawY
float AMotionEvent_getRawY(const(AInputEvent)* motion_event, size_t pointer_index)

Get the original raw X coordinate of this event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

AMotionEvent_getSize
float AMotionEvent_getSize(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current scaled value of the approximate size for the given pointer index. This represents some approximation of the area of the screen being pressed; the actual value in pixels corresponding to the touch is normalized with the device specific range of values and scaled to a value between 0 and 1. The value of size can be used to determine fat touch events.

AMotionEvent_getToolMajor
float AMotionEvent_getToolMajor(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index. The tool area represents the estimated size of the finger or pen that is touching the device independent of its actual touch area at the point of contact.

AMotionEvent_getToolMinor
float AMotionEvent_getToolMinor(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index. The tool area represents the estimated size of the finger or pen that is touching the device independent of its actual touch area at the point of contact.

AMotionEvent_getToolType
int AMotionEvent_getToolType(const(AInputEvent)* motion_event, size_t pointer_index)

Get the tool type of a pointer for the given pointer index. The tool type indicates the type of tool used to make contact such as a finger or stylus, if known.

AMotionEvent_getTouchMajor
float AMotionEvent_getTouchMajor(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current length of the major axis of an ellipse that describes the touch area at the point of contact for the given pointer index.

AMotionEvent_getTouchMinor
float AMotionEvent_getTouchMinor(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current length of the minor axis of an ellipse that describes the touch area at the point of contact for the given pointer index.

AMotionEvent_getX
float AMotionEvent_getX(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current X coordinate of this event for the given pointer index. Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

AMotionEvent_getXOffset
float AMotionEvent_getXOffset(const(AInputEvent)* motion_event)

Get the X coordinate offset. For touch events on the screen, this is the delta that was added to the raw screen coordinates to adjust for the absolute position of the containing windows and views.

AMotionEvent_getXPrecision
float AMotionEvent_getXPrecision(const(AInputEvent)* motion_event)

Get the precision of the X coordinates being reported. You can multiply this number with an X coordinate sample to find the actual hardware value of the X coordinate.

AMotionEvent_getY
float AMotionEvent_getY(const(AInputEvent)* motion_event, size_t pointer_index)

Get the current Y coordinate of this event for the given pointer index. Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

AMotionEvent_getYOffset
float AMotionEvent_getYOffset(const(AInputEvent)* motion_event)

Get the Y coordinate offset. For touch events on the screen, this is the delta that was added to the raw screen coordinates to adjust for the absolute position of the containing windows and views.

AMotionEvent_getYPrecision
float AMotionEvent_getYPrecision(const(AInputEvent)* motion_event)

Get the precision of the Y coordinates being reported. You can multiply this number with a Y coordinate sample to find the actual hardware value of the Y coordinate.

Manifest constants

AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT
enum AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;

Bit shift for the action bits holding the pointer index as defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.

Structs

AInputEvent
struct AInputEvent

Meta key / modifier state.

Meta